package com.bringway.p2p.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.object.SqlCall;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.w3c.dom.html.HTMLIsIndexElement;

import com.bringway.framework.dao.BaseJdbcDao;
import com.bringway.p2p.dao.P2PRoleDao;
import com.bringway.p2p.service.P2PRoleService;

import net.sf.json.JSONObject;

/*
 * @author fan
 * @className P2PRoleServiceImpl
 * @description P2PRole 业务逻辑接口实现类
 * @date 2015年12月20日下午2:40:39
 */
@Service
@Transactional
public class P2PRoleServiceImpl implements P2PRoleService {
	@Autowired
	private P2PRoleDao p2pRoleDao;

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.bringway.p2p.service.P2PRoleService#getRoleList(net.sf.json.
	 * JSONObject)
	 */
	@Override
	public List<Map<String, Object>> getRoleList(JSONObject parms) {
		return p2pRoleDao.getRoleList(parms);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.bringway.p2p.service.P2PRoleService#addRole(net.sf.json.JSONObject)
	 */
	@Override
	public boolean addRole(JSONObject parms) {
		return p2pRoleDao.addRole(parms) > 0;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.bringway.p2p.service.P2PRoleService#delRole(net.sf.json.JSONObject)
	 */
	@Override
	public boolean delRole(JSONObject parms) {
		int i  = p2pRoleDao.delRole(parms);
		int j  = p2pRoleDao.delMenuRole(parms);
		int k  = p2pRoleDao.delUserRole(parms);
		return i>0;
	}
	/*
	 * (non-Javadoc)
	 * @see com.bringway.p2p.service.P2PRoleService#updateRole(net.sf.json.JSONObject)
	 */
	@Override
	public boolean updateRole(JSONObject parms) {
		
		return p2pRoleDao.updateRole(parms);
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.bringway.p2p.service.P2PRoleService#getRoleList()
	 */
	@Override
	public List<Map<String, Object>> getRoleList() {
		
		return p2pRoleDao.getRoleList();
	}

}
